﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using VOL.Core.Utilities;
using VOL.Entity.DrugViewing;
using VOL.SmartMecial.Infrastructure;
using VOL.SmartMecial.IServices.DrugViewings;

namespace VOL.WebApi.Controllers.SmartMecial
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ADrugViewingController : ControllerBase
    {
        private readonly IDrugViewingService _drugViewingService;

        public ADrugViewingController(IDrugViewingService drugViewingService)
        {
            _drugViewingService = drugViewingService;
        }
        [HttpGet]
        public async Task<WebResponseContent> QueryDrugViewing(string? drugName)
        {
            return await _drugViewingService.QueryDrugViewing(drugName);
        }
        [HttpPost]
        public async Task<string> AddDrugViewing([FromBody] DrugViewingModel drug)
        {
            return await _drugViewingService.AddDrugViewing(drug);
        }
        [HttpPost]
        public async Task<string> UpdDrugViewing([FromBody]DrugViewingModel drug)
        {
            return await _drugViewingService.UpdDrugViewing(drug);
        }
    }
}
